package com.feng.newconfig.demos.nacosdiscoveryconsumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class EchoServiceFallbackFactory implements FallbackFactory<EchoService> {

    @Override
    public EchoService create(Throwable cause) {
        return new EchoService() {
            @Override
            public String echo(String message) {
                log.error("触发熔断");
                return "触发熔断";
            }
        };
    }
}